<?php if(!IS_AJAX){?>
<include file="Public:header" />
<form id="teamdatalistform" action="<?php echo U('Analysis/department');?>">
<div class="row">
  <div class="col-sm-7 col-md-8 col-lg-9">
    <div class="directory-info-row" style="margin-top:0;">
      <section class="panel">
        <header class="panel-heading custom-tab ">
          <ul class="nav nav-tabs">
            <li class="active">
              <a href="#home" data-toggle="tab">积分排名结果</a>
            </li>
          </ul>
        </header>
        <style>
		  .table-custom{ border:1px solid #ccc; border-collapse:separate; border-radius:5px; overflow:hidden;}
		  .table-custom tr{ color:#666;}
		  .table-custom thead th{ padding:14px !important; background:linear-gradient(to bottom,#fdfdfd 30%,#e9e9e9); text-align:center;}
		  .table-custom tr td{line-height: 36px !important;padding-top: 15px !important;padding-left: 15px !important; border-top:none !important;}
		  .table-custom tr img{ border:1px solid #ccc; margin-right:5px;}
		  .table-custom tr .social-links{ margin:5px 0;}
        </style>
        <div class="panel-body">
          <div class="tab-content">
            <div class="tab-pane active " id="home">
              <div class="panel-body">
                <div class="icheck">
                  <div style="display:inline-block;">
                    <div class="radio square-red single-row">
                      <input type="radio" value="year" checked name="time">
                      <label>今年</label>
                    </div>
                  </div>
                  <div style="display:inline-block;">
                    <div class="radio square-red single-row">
                      <input type="radio" value="month" checked name="time">
                      <label>本月</label>
                    </div>
                  </div>
                  <div style="display:inline-block;">
                    <div class="radio square-red single-row">
                      <input type="radio" value="week" checked name="time">
                      <label>本周</label>
                    </div>
                  </div>
                  <div style="display:inline-block;">
                    <div class="radio square-red single-row">
                      <input type="radio" value="day" checked name="time">
                      <label>今天</label>
                    </div>
                  </div>
                </div>
                <input class="form-control" id="starttime" name="starttime" readonly onclick="WdatePicker();" style="cursor:pointer;display: inline; width:auto;" value="" placeholder="起始时间" type="text">
                <input class="form-control" id="endtime" name="endtime" onclick="WdatePicker();" readonly style="cursor:pointer;display:inline; width:auto;" value="" placeholder="结束时间" type="text">
              </div>
              <table class="table  table-hover general-table table-custom table-striped">
                <thead>
                  <tr>
                  
                   <th> 名次</th>
                  
                    <th> 姓名</th>
                    
                    
                    <th>分数</th>
                    
                  </tr>
                </thead>
                <tbody id="teamdatalist">
                  <?php }?>
                  
                  <!-- 数据主体 -->
                  
                  <!-- 数据主体结束 -->
                  <?php if(!IS_AJAX){?>
                </tbody>
              </table>
            </div>
          </div>
        </div>
      </section>
    </div>
    <div class="PagesBox" id="teamdatalistpages"><?php echo $pages;?></div>
  </div>
  <div class="col-sm-5 col-md-4 col-lg-3">
    
      
      <div class="panel">
        <header class="panel-heading"> 积分类型 </header>
        <div class="panel-body">
          <div class="icheck">
            <volist name="integraltype" id="vo">
              <div style="display:inline-block;">
                <div class="radio square-red single-row">
                  <input type="radio" value="{$vo.id}" <eq name="key" value="0">checked</eq> name="integral_type">
                  <label>{$vo.remark}</label>
                </div>
              </div>
            </volist>
          </div>
        </div>
      </div>
      <div class="panel">
        <header class="panel-heading"> 选择排名范围 </header>
        <div class="panel-body">
          <div class="memberpositionbox"></div>
          <div class="ztree" id="memberpositiontree"></div>
        </div>
      </div>
      <div class="panel">
        <header class="panel-heading"> 积分来源 </header>
        <div class="panel-body icheck">
          <volist name="taskform" id="vo">
            <div class="square-red single-row">
              <input type="checkbox" checked name="taskform[]" value="{$vo.id}" />
              <label>{$vo.name}</label>
            </div>
          </volist>
          <div class="square-red single-row">
              <input type="checkbox" checked name="taskform[]" value="0" />
              <label>其它</label>
            </div>
        </div>
      </div>
    
  </div>
</div>
</form>
<include file="Public:script" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Js/zTree_v3/css/zTreeStyle/zTreeStyle.css">
<script type="text/javascript" src="/Public/Js/zTree_v3/js/jquery.ztree.core-3.5.js"></script> 
<script type="text/javascript">
	$('#teamdatalist').ajaxlist();
	$('.icheck input').change(function(e) {
        $('#teamdatalistform').submit();
    });
	
	
	
		var setting = { 
			view: {
				selectedMulti: false
			},
			async: {
				enable: true,
				url:"{:U('Employee/membertree')}", 
				autoParam:["id", "name=n", "level=lv"],
				otherParam:{"otherParam":"zTreeAsyncTest"},
				dataFilter: filter
			},
			callback: { 
				beforeClick: beforeClick,
				beforeAsync: beforeAsync,
				onAsyncError: onAsyncError,
				onAsyncSuccess: onAsyncSuccess
			}
		};

		function filter(treeId, parentNode, childNodes) {
			if (!childNodes) return null;
			for (var i=0, l=childNodes.length; i<l; i++) {
				childNodes[i].name = childNodes[i].name.replace(/\.n/g, '.');
			}
			return childNodes;
		}
		function beforeClick(treeId, treeNode) {
			
			
			var html = '<div id="member_position_id'+treeNode.id+'" class="alert alert-info fade in" style="display:inline-block; margin-bottom:2px; margin-right:2px; padding:5px;"><button type="button" class="close close-sm" onclick="$(this).parent().remove();$(\'#teamdatalistform\').submit();" data-dismiss="alert"> <i class="fa icon-times"></i> </button><strong><input type="hidden" value="'+treeNode.id+'" name="position_id[]" class="NodeId" />'+treeNode.name+'</strong> </div>';
			$('#member_position_id'+treeNode.id).remove();
			$(html).appendTo('.memberpositionbox');
			
			
			$('#teamdatalistform').submit();
			
			
			if (!treeNode.isParent) {
				return false;
			} else {
				return true;
			}
		}
		var className = "dark";
		function beforeAsync(treeId, treeNode) {
			className = (className === "dark" ? "":"dark");
			return true;
		}
		function onAsyncError(event, treeId, treeNode, XMLHttpRequest, textStatus, errorThrown) {
			
		}
		function onAsyncSuccess(event, treeId, treeNode, msg) {
			
		}

		$(document).ready(function(){
			$.fn.zTree.init($("#memberpositiontree"), setting);
		});

		

	</script>
<style>

#memberpositiontree .highlight_red {color:#A60000;}
#memberpositiontree .highlight_green {color:#A7F43D;}
#memberpositiontree li {list-style: circle;font-size: 14px; list-style-type:none; cursor:pointer}

#memberpositiontree li.title {list-style: none;}
#memberpositiontree ul.list {margin-left: 17px;}
#memberpositiontree li a{padding:4px;}
#memberpositiontree div.content_wrap {}
#memberpositiontree div.content_wrap div.left{}
#memberpositiontree div.content_wrap div.right{}
#memberpositiontree div.zmemberpositiontreeBackground {}
#memberpositiontree li .button{margin-top:3px;}
#memberpositiontree ul.ztree {margin-top: 10px;border: 1px solid #617775;background: #f0f6e4;overflow-y:scroll;overflow-x:auto;}
#memberpositiontree ul.log {border: 1px solid #617775;background: #f0f6e4;width:300px;height:170px;overflow: hidden;}
#memberpositiontree ul.log.small {height:45px;}
#memberpositiontree ul.log li {color: #666666;list-style: none;padding-left: 10px;}
#memberpositiontree ul.log li.dark {background-color: #E3E3E3;}

/* ruler */
#memberpositiontree div.ruler {height:20px; width:220px; background-color:#f0f6e4;border: 1px solid #333; margin-bottom: 5px; cursor: pointer}
#memberpositiontree div.ruler div.cursor {height:20px; width:30px; background-color:#3C6E31; color:white; text-align: right; padding-right: 5px; cursor: pointer}
#memberpositiontree{margin-top:0; height:100%;}
#memberpositiontree .button.ico_close{display:none;}
#memberpositiontree .button.ico_open,.button.ico_close,.ico_docu{display:none !important;} 

.radio.square-red.single-row{margin-bottom:5px; margin-top:5px;}
</style>
</body></html><?php }?>